<template>
  <el-card class="content-card">
    <template #header>
      <div class="card-header">
        <h3>业务数据</h3>
      </div>
    </template>
    <div class="business-stats">
      <div class="business-item" v-for="(item, key) in businessStats" :key="key">
        <div class="business-title">{{ item.name }}</div>
        <div class="business-value">
          {{ item.type === 'amount' ? '¥' + item.value_format : item.value }}
        </div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
  interface BusinessItem {
    name: string
    value: number
    value_format?: string
    type?: 'amount' | 'count'
  }

  interface Props {
    businessStats: Record<string, BusinessItem>
  }

  const props = defineProps<Props>()
</script>

<style scoped>
  /* 业务数据样式 */
  .content-card {
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: none;
  }

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
  }

  .business-stats {
    padding: 16px;
  }

  .business-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .business-item:last-child {
    border-bottom: none;
  }

  .business-title {
    font-size: 14px;
    color: #666;
  }

  .business-value {
    font-size: 16px;
    font-weight: bold;
    color: #333;
  }

  /* 响应式设计 */
  @media (max-width: 768px) {
    .business-stats {
      padding: 12px;
    }

    .business-item {
      padding: 10px 0;
    }

    .business-title {
      font-size: 13px;
    }

    .business-value {
      font-size: 14px;
    }
  }
</style>
